perm filename TIMER.LSP[TIM,LSP]1 blob sn#657781 filedate 1982-05-10 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	(declare (setq defmacro-for-compiling ()) (*expr ttime dtime loadav))
C00004 ENDMK
CāŠ—;
(declare (setq defmacro-for-compiling ()) (*expr ttime dtime loadav))

(defmacro timer (name form . args)
	  `(defun ,name ,args
		  ((lambda (t1 t2 t3 gt lb la)
			   ,form
			   (setq t1 (- (runtime) t1)
				 t2 (- (dtime) t2)
				 t3 (- (ttime) t3)
				 gt (- (status gctime) gt)
				 la (loadav))
			   (terpri)
			   (princ "Cpu Time = ")
			   (princ (QUOTIENT (FLOAT  (- t1 gt))
					    1000000.))
			   (terpri)
			   (princ "Elapsed Time = ")
			   (princ (quotient (float t2) 60.0))
			   (terpri)
			   (princ "Wholine Time = ")
			   (princ (quotient (float t3) 60.0))
			   (terpri)
			   (princ "GC Time = ")
			   (princ (quotient (float gt) 1000000.))
			   (terpri)
			   (princ "Load Average Before = ")
			   (princ lb)
			   (terpri)
			   (princ "Load Average After  = ")
			   (princ la)(terpri)
			   (princ "Average Load Average =")
			   (princ  (//$ (+$ la lb) 2.0))(terpri))
		   (runtime) (dtime)(ttime)(status gctime)(loadav) 0)))

(*rset (nouuo ()))